package com.tfswx.jcyw.ruleenginedesigner.api;

import com.tfswx.jcyw.ruleenginedesigner.dto.fs.FileDownloadInputDTO;
import com.tfswx.jcyw.ruleenginedesigner.service.FsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * @author ricky
 * @date 2021/8/31
 */
@RequestMapping("fs")
@Api(tags = "文件服务")
@RestController
public class FsController {
    @Resource
    private FsService fsService;

    @ApiOperation("文件预览、下载")
    @PostMapping(value = "download", produces = "application/octet-stream")
    public void downloadPost(@RequestBody @Validated FileDownloadInputDTO inputDto) {
        fsService.download(inputDto);
    }

    @ApiOperation("文件预览、下载")
    @GetMapping(value = "download", produces = "application/octet-stream")
    public void downloadGet(@Validated FileDownloadInputDTO inputDto) {
        fsService.download(inputDto);
    }
}
